package fxbattle.fxgui;

import javafx.scene.CustomNode;
import javafx.scene.shape.Polygon;
import javafx.scene.Node;
import java.lang.Math;
import javafx.scene.paint.Paint;

/**
 * @author spina
 */
var cos60: Number = Math.cos(Math.toRadians(30));

public class EqulateralTriangle extends CustomNode {
    
    public var size: Number = 10;
    public def points = pointArray();
    public var color: Paint;
    
    bound function pointArray(): Number[] {
        return [ 0, size * cos60, size/2, 0, size, size * cos60 ];
    }
    
    
    public override function create(): Node {
    	return Polygon {
            cache: true
			points: points   		   
   		    fill: bind color
       };
   }
		
    
}